package cn.gx.kevin.domain;

import org.apache.commons.lang3.StringUtils;

/***
 *@description : avg sum计算参数
 *@author : kevin.huang
 *@date : 2019/10/26 17:07
 @modified by
 ***/
public class DynamicComputedParam extends  DynamicBaseWhereParam{

    /******
     * sum / avg 计算的字段
     * ********/
    public String computedFeild;

    /******
     * sum / avg 计算的字段
     * ********/
    public String getComputedFeild() {
        return computedFeild;
    }

    /******
     * sum / avg 计算的字段
     * ********/
    public void setComputedFeild(String computedFeild) {
        this.computedFeild = this.replaceIllegalChars( computedFeild );
    }

    /******
     * 计算方式，sum / avg
     * ********/
    public String computeType;

    /******
     * 计算方式，sum / avg
     * ********/
    public String getComputeType() {
        if(StringUtils.isEmpty(computeType)){
            return null;
        }
        return computeType;
    }

    /******
     * 计算方式，sum / avg /count
     * ********/
    public void setComputeType(String computeType) {
        if("count".equalsIgnoreCase(computeType) || "sum".equalsIgnoreCase(computeType) || "avg".equalsIgnoreCase(computeType)){
            this.computeType = computeType;
        }
    }

    /******
     * group by 字段名称，可空
     * ********/
    public String getGroupByFeild() {
        if(StringUtils.isEmpty(groupByFeild)){
            return null;
        }
        return groupByFeild;
    }

    /******
     * group by 字段名称
     * ********/
    public void setGroupByFeild(String groupByFeild) {
        this.groupByFeild = this.replaceIllegalChars( groupByFeild);
    }

    /******
     * group by 字段名称
     * ********/
    String groupByFeild;

}
